package praktikumid.kaug;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class Nuputa extends JFrame {

	public static void main(String[] args) {
		Nuputa n = new Nuputa();
		
		JPanel panel = new JPanel(
				new BorderLayout());
		
		ActionListener listener = new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				if (e.getActionCommand().equals("OK")) {
					System.out.println("vajutati OK");
				} else {
					System.out.println("savi");
				}
			}
		}; // -listener
		
		JButton okButton = new JButton("OK");
		okButton.addActionListener(listener);
		
		JButton exitButton = new JButton("Exit");
		exitButton.addActionListener(listener);
		
		panel.add(okButton, BorderLayout.NORTH);
		panel.add(exitButton, BorderLayout.SOUTH);
		
		n.getContentPane().add(panel);
		
		n.setDefaultCloseOperation(EXIT_ON_CLOSE);
		n.pack();
		n.setVisible(true);
	}
}
